<template>
	<view>
		<view>
			<!-- 商品图片 -->
			<image :src="goods.goods_img_url"></image>
			<!-- 商品名称 -->
			<text>名称{{goods.goods_name}}</text>
			<!-- 商品描述 -->
			<text>描述{{goods.detail_page}}</text>
			<!-- 商品价格 -->
			<text>价格{{goods.price}}</text>
			<!-- 库存 -->
			<text>库存{{goods.stocks}}</text>
		</view>
		<view>
			<view>
				<text>默认地址</text>
				<text>---省---市---县</text>
				<text>详细地址{{address.address}}</text>
				<text>收件人{{address.address_name}}</text>
				<text>手机号{{address.mobile}}</text>
				<button>选择地址</button>
			</view>
			<!-- 选择地址 -->
		</view>
		<view>
			<text>个数------</text>
			<!-- 购买个数 -->
			<!-- 总价 -->
			<text>总价------</text>
		</view>
		<view>
			<button>提交订单</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				goods:"",
				address:"",
				userInfo:"",
				order:"",
			}
		},
		methods: {
			
		},
		onLoad(){
			const eventChannel=this.getOpenerEventChannel();
			this.userInfo=uni.getStorageSync("userInfo")
			eventChannel.on("navToOrder", (res) => {
					console.log(res)
					this.goods=res
			});
			console.log(this.userInfo)
			let data={
				user_id:this.userInfo.id,
			}
			console.log(data)
			let that= this;
			uni.request({
				url:"http://localhost:8090/address/getDefaultAddress",
				data:data,
				method:"POST",
				success(res) {
					that.address=res.data.data
				}
			})
		},
		
	}
</script>

<style>

</style>
